using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CanvasClose : MonoBehaviour
{
    public Image canvasToClose; // 要关闭的Canvas
    public Image canvasToOpen; // 要开启的Canvas

    void Start()
    {
        StartCoroutine(SwitchCanvas()); // 启动协程
    }

    IEnumerator SwitchCanvas()
    {
        yield return new WaitForSeconds(2); // 等待2秒

        // 关闭第一个Canvas
        canvasToClose.gameObject.SetActive(false);

        // 打开第二个Canvas
        canvasToOpen.gameObject.SetActive(true);
    }
}
